package antidestiny.utilib;

/**
 * Created by Hero on 2016/7/29.
 */
public class StringUtils {
    public static String replace(boolean ignoreCase,String source
            ,String oldString,String newString){
        int index;
        if (ignoreCase){
            String lower=source.toLowerCase();
            String lowerOld=oldString.toLowerCase();
            index=lower.indexOf(lowerOld);
        }else index=source.indexOf(oldString);
        StringBuilder builder=new StringBuilder(source);
        builder.replace(index,index+oldString.length(),newString);
        return builder.toString();
    }
}
